package com.example.fish.dto;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.time.LocalDateTime;

@Data
public class UserDTO {

    private Integer idUser;              // 查询时返回

    @NotBlank(groups = Create.class)
    @Pattern(regexp = "^[0-9]{8}$", groups = Create.class,
            message = "账号必须是8位数字")
    private String account;

    @NotBlank(groups = Create.class)
    @Size(min = 8, groups = Create.class, message = "密码至少8位")
    private String password;

    @NotBlank(groups = Create.class)
    @Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,6}$", groups = Create.class,
            message = "姓名需为1-6个中文字符")
    private String name;

    @NotBlank(groups = Create.class)
    private String nickname;

    @NotBlank(groups = Create.class)
    @Pattern(regexp = "^[0-9]{11}$", groups = Create.class,
            message = "联系方式必须为11位数字")
    private String contact;

    private String status;               // 查询/更新状态时返回

    private LocalDateTime createTime;    // 查询时返回
    private LocalDateTime updateTime;    // 查询时返回

    /** 新增分组接口标记 */
    public interface Create {}
}
